describe("(jsturbo) String", function() {

    describe("toNumber", function() {
        it("should be able to recognize different decimal and thousand separators", function() {
            var num = '1.234,56'.toNumber();
            expect(num).toEqual(1234.56);

            var num2 = '1,234.56'.toNumber();
            expect(num2).toEqual(1234.56);
        });

        it("should be able to ignore thousand separators", function() {
            var num = '1.234.567,89'.toNumber();
            expect(num).toEqual(1234567.89);
        });

        it("should be able to ignore wrong separators", function() {
            var num = '1.234.567.89'.toNumber();
            expect(num).toEqual(1234567.89);
        });

        it("should be able to ignore currency signs", function() {
            var num = 'R$ 1.234,56'.toNumber();
            expect(num).toEqual(1234.56);

            var num2 = 'USD 1,234.56'.toNumber();
            expect(num2).toEqual(1234.56);
        });

        it("should be able to ignore other characters", function() {
            var num = '"""1.234,56"""'.toNumber();
            expect(num).toEqual(1234.56);

            var num2 = '#@W1,234.56CF&*Y'.toNumber();
            expect(num2).toEqual(1234.56);
        });

        it("should return NaN on undefined, null or not a number", function() {
            expect(''.toNumber()).toEqual(NaN);
            expect('naosounumero'.toNumber()).toEqual(NaN);
        });
    });

    describe("pad", function() {
        it("should pad strings with 0", function() {
            expect('10'.pad(4)).toEqual('0010');
            expect('9'.pad(4)).toEqual('0009');
            expect('12345'.pad(4)).toEqual('12345');
        });

        it("should pad strings with custom char", function() {
            expect('10'.pad(4, '?')).toEqual('??10');
            expect('9'.pad(4, '?')).toEqual('???9');
            expect('12345'.pad(4, '?')).toEqual('12345');
        });
    });

    describe("isNumber", function() {
        it("should indentify valid numbers", function() {
            expect('10'.isNumber()).toBeTruthy();
            expect('10.9'.isNumber()).toBeTruthy();
        });

        it("should indentify invalid numbers", function() {
            expect('10x'.isNumber()).toBeFalsy();
            expect('1$'.isNumber()).toBeFalsy();
            expect('10.9.2'.isNumber()).toBeFalsy();
        });

        it("should indentify valid numbers with custom separators", function() {
            expect('10,123'.isNumber(',')).toBeTruthy();
        });

        it("should indentify invalid numbers with custom separators", function() {
            expect('1.'.isNumber(',')).toBeFalsy();
        });

    });

});
